
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>LLVM Makefile Guide &mdash; LLVM 3.7 documentation</title>
    
    <link rel="stylesheet" href="_static/llvm-theme.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '3.7',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="LLVM 3.7 documentation" href="index.html" />
    <link rel="next" title="Creating an LLVM Project" href="Projects.html" />
    <link rel="prev" title="LLVM Developer Policy" href="DeveloperPolicy.html" />
<style type="text/css">
  table.right { float: right; margin-left: 20px; }
  table.right td { border: 1px solid #ccc; }
</style>

  </head>
  <body role="document">
<div class="logo">
  <a href="index.html">
    <img src="_static/logo.png"
         alt="LLVM Logo" width="250" height="88"/></a>
</div>

    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="Projects.html" title="Creating an LLVM Project"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="DeveloperPolicy.html" title="LLVM Developer Policy"
             accesskey="P">previous</a> |</li>
  <li><a href="http://llvm.org/">LLVM Home</a>&nbsp;|&nbsp;</li>
  <li><a href="index.html">Documentation</a>&raquo;</li>
 
      </ul>
    </div>


    <div class="document">
      <div class="documentwrapper">
          <div class="body" role="main">
            
  <div class="section" id="llvm-makefile-guide">
<h1>LLVM Makefile Guide<a class="headerlink" href="#llvm-makefile-guide" title="Permalink to this headline">¶</a></h1>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#introduction" id="id3">Introduction</a></li>
<li><a class="reference internal" href="#general-concepts" id="id4">General Concepts</a><ul>
<li><a class="reference internal" href="#projects" id="id5">Projects</a></li>
<li><a class="reference internal" href="#variable-values" id="id6">Variable Values</a></li>
<li><a class="reference internal" href="#including-makefiles" id="id7">Including Makefiles</a><ul>
<li><a class="reference internal" href="#makefile" id="id8"><code class="docutils literal"><span class="pre">Makefile</span></code></a></li>
<li><a class="reference internal" href="#makefile-common" id="id9"><code class="docutils literal"><span class="pre">Makefile.common</span></code></a></li>
<li><a class="reference internal" href="#makefile-config" id="id10"><code class="docutils literal"><span class="pre">Makefile.config</span></code></a></li>
<li><a class="reference internal" href="#makefile-rules" id="id11"><code class="docutils literal"><span class="pre">Makefile.rules</span></code></a></li>
<li><a class="reference internal" href="#comments" id="id12">Comments</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#tutorial" id="id13">Tutorial</a><ul>
<li><a class="reference internal" href="#libraries" id="id14">Libraries</a><ul>
<li><a class="reference internal" href="#loadable-modules" id="id15">Loadable Modules</a></li>
</ul>
</li>
<li><a class="reference internal" href="#tools" id="id16">Tools</a><ul>
<li><a class="reference internal" href="#jit-tools" id="id17">JIT Tools</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#targets-supported" id="id18">Targets Supported</a><ul>
<li><a class="reference internal" href="#all-default" id="id19"><code class="docutils literal"><span class="pre">all</span></code> (default)</a></li>
<li><a class="reference internal" href="#all-local" id="id20"><code class="docutils literal"><span class="pre">all-local</span></code></a></li>
<li><a class="reference internal" href="#check" id="id21"><code class="docutils literal"><span class="pre">check</span></code></a></li>
<li><a class="reference internal" href="#check-local" id="id22"><code class="docutils literal"><span class="pre">check-local</span></code></a></li>
<li><a class="reference internal" href="#clean" id="id23"><code class="docutils literal"><span class="pre">clean</span></code></a></li>
<li><a class="reference internal" href="#clean-local" id="id24"><code class="docutils literal"><span class="pre">clean-local</span></code></a></li>
<li><a class="reference internal" href="#dist" id="id25"><code class="docutils literal"><span class="pre">dist</span></code></a></li>
<li><a class="reference internal" href="#dist-check" id="id26"><code class="docutils literal"><span class="pre">dist-check</span></code></a></li>
<li><a class="reference internal" href="#dist-clean" id="id27"><code class="docutils literal"><span class="pre">dist-clean</span></code></a></li>
<li><a class="reference internal" href="#install" id="id28"><code class="docutils literal"><span class="pre">install</span></code></a></li>
<li><a class="reference internal" href="#preconditions" id="id29"><code class="docutils literal"><span class="pre">preconditions</span></code></a></li>
<li><a class="reference internal" href="#printvars" id="id30"><code class="docutils literal"><span class="pre">printvars</span></code></a></li>
<li><a class="reference internal" href="#reconfigure" id="id31"><code class="docutils literal"><span class="pre">reconfigure</span></code></a></li>
<li><a class="reference internal" href="#spotless" id="id32"><code class="docutils literal"><span class="pre">spotless</span></code></a></li>
<li><a class="reference internal" href="#tags" id="id33"><code class="docutils literal"><span class="pre">tags</span></code></a></li>
<li><a class="reference internal" href="#uninstall" id="id34"><code class="docutils literal"><span class="pre">uninstall</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#variables" id="id35">Variables</a><ul>
<li><a class="reference internal" href="#control-variables" id="id36">Control Variables</a></li>
<li><a class="reference internal" href="#override-variables" id="id37">Override Variables</a></li>
<li><a class="reference internal" href="#readable-variables" id="id38">Readable Variables</a></li>
<li><a class="reference internal" href="#internal-variables" id="id39">Internal Variables</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="introduction">
<h2><a class="toc-backref" href="#id3">Introduction</a><a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
<p>This document provides <em>usage</em> information about the LLVM makefile system. While
loosely patterned after the BSD makefile system, LLVM has taken a departure from
BSD in order to implement additional features needed by LLVM.  Although makefile
systems, such as <code class="docutils literal"><span class="pre">automake</span></code>, were attempted at one point, it has become clear
that the features needed by LLVM and the <code class="docutils literal"><span class="pre">Makefile</span></code> norm are too great to use
a more limited tool. Consequently, LLVM requires simply GNU Make 3.79, a widely
portable makefile processor. LLVM unabashedly makes heavy use of the features of
GNU Make so the dependency on GNU Make is firm. If you&#8217;re not familiar with
<code class="docutils literal"><span class="pre">make</span></code>, it is recommended that you read the <a class="reference external" href="http://www.gnu.org/software/make/manual/make.html">GNU Makefile Manual</a>.</p>
<p>While this document is rightly part of the <a class="reference external" href="ProgrammersManual.html">LLVM Programmer&#8217;s
Manual</a>, it is treated separately here because of the
volume of content and because it is often an early source of bewilderment for
new developers.</p>
</div>
<div class="section" id="general-concepts">
<h2><a class="toc-backref" href="#id4">General Concepts</a><a class="headerlink" href="#general-concepts" title="Permalink to this headline">¶</a></h2>
<p>The LLVM Makefile System is the component of LLVM that is responsible for
building the software, testing it, generating distributions, checking those
distributions, installing and uninstalling, etc. It consists of a several files
throughout the source tree. These files and other general concepts are described
in this section.</p>
<div class="section" id="projects">
<h3><a class="toc-backref" href="#id5">Projects</a><a class="headerlink" href="#projects" title="Permalink to this headline">¶</a></h3>
<p>The LLVM Makefile System is quite generous. It not only builds its own software,
but it can build yours too. Built into the system is knowledge of the
<code class="docutils literal"><span class="pre">llvm/projects</span></code> directory. Any directory under <code class="docutils literal"><span class="pre">projects</span></code> that has both a
<code class="docutils literal"><span class="pre">configure</span></code> script and a <code class="docutils literal"><span class="pre">Makefile</span></code> is assumed to be a project that uses the
LLVM Makefile system.  Building software that uses LLVM does not require the
LLVM Makefile System nor even placement in the <code class="docutils literal"><span class="pre">llvm/projects</span></code>
directory. However, doing so will allow your project to get up and running
quickly by utilizing the built-in features that are used to compile LLVM. LLVM
compiles itself using the same features of the makefile system as used for
projects.</p>
<p>For further details, consult the <a class="reference external" href="Projects.html">Projects</a> page.</p>
</div>
<div class="section" id="variable-values">
<h3><a class="toc-backref" href="#id6">Variable Values</a><a class="headerlink" href="#variable-values" title="Permalink to this headline">¶</a></h3>
<p>To use the makefile system, you simply create a file named <code class="docutils literal"><span class="pre">Makefile</span></code> in your
directory and declare values for certain variables.  The variables and values
that you select determine what the makefile system will do. These variables
enable rules and processing in the makefile system that automatically Do The
Right Thing (C).</p>
</div>
<div class="section" id="including-makefiles">
<h3><a class="toc-backref" href="#id7">Including Makefiles</a><a class="headerlink" href="#including-makefiles" title="Permalink to this headline">¶</a></h3>
<p>Setting variables alone is not enough. You must include into your Makefile
additional files that provide the rules of the LLVM Makefile system. The various
files involved are described in the sections that follow.</p>
<div class="section" id="makefile">
<h4><a class="toc-backref" href="#id8"><code class="docutils literal"><span class="pre">Makefile</span></code></a><a class="headerlink" href="#makefile" title="Permalink to this headline">¶</a></h4>
<p>Each directory to participate in the build needs to have a file named
<code class="docutils literal"><span class="pre">Makefile</span></code>. This is the file first read by <code class="docutils literal"><span class="pre">make</span></code>. It has three
sections:</p>
<ol class="arabic simple">
<li>Settable Variables &#8212; Required that must be set first.</li>
<li><code class="docutils literal"><span class="pre">include</span> <span class="pre">$(LEVEL)/Makefile.common</span></code> &#8212; include the LLVM Makefile system.</li>
<li>Override Variables &#8212; Override variables set by the LLVM Makefile system.</li>
</ol>
</div>
<div class="section" id="makefile-common">
<span id="level-makefile-common"></span><h4><a class="toc-backref" href="#id9"><code class="docutils literal"><span class="pre">Makefile.common</span></code></a><a class="headerlink" href="#makefile-common" title="Permalink to this headline">¶</a></h4>
<p>Every project must have a <code class="docutils literal"><span class="pre">Makefile.common</span></code> file at its top source
directory. This file serves three purposes:</p>
<ol class="arabic simple">
<li>It includes the project&#8217;s configuration makefile to obtain values determined
by the <code class="docutils literal"><span class="pre">configure</span></code> script. This is done by including the
<a class="reference internal" href="#level-makefile-config">$(LEVEL)/Makefile.config</a> file.</li>
<li>It specifies any other (static) values that are needed throughout the
project. Only values that are used in all or a large proportion of the
project&#8217;s directories should be placed here.</li>
<li>It includes the standard rules for the LLVM Makefile system,
<a class="reference internal" href="#llvm-src-root-makefile-rules">$(LLVM_SRC_ROOT)/Makefile.rules</a>.  This file is the <em>guts</em> of the LLVM
<code class="docutils literal"><span class="pre">Makefile</span></code> system.</li>
</ol>
</div>
<div class="section" id="makefile-config">
<span id="level-makefile-config"></span><h4><a class="toc-backref" href="#id10"><code class="docutils literal"><span class="pre">Makefile.config</span></code></a><a class="headerlink" href="#makefile-config" title="Permalink to this headline">¶</a></h4>
<p>Every project must have a <code class="docutils literal"><span class="pre">Makefile.config</span></code> at the top of its <em>build</em>
directory. This file is <strong>generated</strong> by the <code class="docutils literal"><span class="pre">configure</span></code> script from the
pattern provided by the <code class="docutils literal"><span class="pre">Makefile.config.in</span></code> file located at the top of the
project&#8217;s <em>source</em> directory. The contents of this file depend largely on what
configuration items the project uses, however most projects can get what they
need by just relying on LLVM&#8217;s configuration found in
<code class="docutils literal"><span class="pre">$(LLVM_OBJ_ROOT)/Makefile.config</span></code>.</p>
</div>
<div class="section" id="makefile-rules">
<span id="llvm-src-root-makefile-rules"></span><h4><a class="toc-backref" href="#id11"><code class="docutils literal"><span class="pre">Makefile.rules</span></code></a><a class="headerlink" href="#makefile-rules" title="Permalink to this headline">¶</a></h4>
<p>This file, located at <code class="docutils literal"><span class="pre">$(LLVM_SRC_ROOT)/Makefile.rules</span></code> is the heart of the
LLVM Makefile System. It provides all the logic, dependencies, and rules for
building the targets supported by the system. What it does largely depends on
the values of <code class="docutils literal"><span class="pre">make</span></code> <a class="reference internal" href="#variables">variables</a> that have been set <em>before</em>
<code class="docutils literal"><span class="pre">Makefile.rules</span></code> is included.</p>
</div>
<div class="section" id="comments">
<h4><a class="toc-backref" href="#id12">Comments</a><a class="headerlink" href="#comments" title="Permalink to this headline">¶</a></h4>
<p>User <code class="docutils literal"><span class="pre">Makefile</span></code>s need not have comments in them unless the construction is
unusual or it does not strictly follow the rules and patterns of the LLVM
makefile system. Makefile comments are invoked with the pound (<code class="docutils literal"><span class="pre">#</span></code>) character.
The <code class="docutils literal"><span class="pre">#</span></code> character and any text following it, to the end of the line, are
ignored by <code class="docutils literal"><span class="pre">make</span></code>.</p>
</div>
</div>
</div>
<div class="section" id="tutorial">
<h2><a class="toc-backref" href="#id13">Tutorial</a><a class="headerlink" href="#tutorial" title="Permalink to this headline">¶</a></h2>
<p>This section provides some examples of the different kinds of modules you can
build with the LLVM makefile system. In general, each directory you provide will
build a single object although that object may be composed of additionally
compiled components.</p>
<div class="section" id="libraries">
<h3><a class="toc-backref" href="#id14">Libraries</a><a class="headerlink" href="#libraries" title="Permalink to this headline">¶</a></h3>
<p>Only a few variable definitions are needed to build a regular library.
Normally, the makefile system will build all the software into a single
<code class="docutils literal"><span class="pre">libname.o</span></code> (pre-linked) object. This means the library is not searchable and
that the distinction between compilation units has been dissolved. Optionally,
you can ask for a shared library (.so) or archive library (.a) built.  Archive
libraries are the default. For example:</p>
<div class="highlight-makefile"><div class="highlight"><pre><span class="nv">LIBRARYNAME</span> <span class="o">=</span> mylib
<span class="nv">SHARED_LIBRARY</span> <span class="o">=</span> 1
<span class="nv">BUILD_ARCHIVE</span> <span class="o">=</span> 1
</pre></div>
</div>
<p>says to build a library named <code class="docutils literal"><span class="pre">mylib</span></code> with both a shared library
(<code class="docutils literal"><span class="pre">mylib.so</span></code>) and an archive library (<code class="docutils literal"><span class="pre">mylib.a</span></code>) version. The contents of all
the libraries produced will be the same, they are just constructed differently.
Note that you normally do not need to specify the sources involved. The LLVM
Makefile system will infer the source files from the contents of the source
directory.</p>
<p>The <code class="docutils literal"><span class="pre">LOADABLE_MODULE=1</span></code> directive can be used in conjunction with
<code class="docutils literal"><span class="pre">SHARED_LIBRARY=1</span></code> to indicate that the resulting shared library should be
openable with the <code class="docutils literal"><span class="pre">dlopen</span></code> function and searchable with the <code class="docutils literal"><span class="pre">dlsym</span></code> function
(or your operating system&#8217;s equivalents). While this isn&#8217;t strictly necessary on
Linux and a few other platforms, it is required on systems like HP-UX and
Darwin. You should use <code class="docutils literal"><span class="pre">LOADABLE_MODULE</span></code> for any shared library that you
intend to be loaded into an tool via the <code class="docutils literal"><span class="pre">-load</span></code> option.  <a class="reference internal" href="WritingAnLLVMPass.html#writing-an-llvm-pass-makefile"><span>Pass
documentation</span></a> has an example of why you might
want to do this.</p>
<div class="section" id="loadable-modules">
<h4><a class="toc-backref" href="#id15">Loadable Modules</a><a class="headerlink" href="#loadable-modules" title="Permalink to this headline">¶</a></h4>
<p>In some situations, you need to create a loadable module. Loadable modules can
be loaded into programs like <code class="docutils literal"><span class="pre">opt</span></code> or <code class="docutils literal"><span class="pre">llc</span></code> to specify additional passes to
run or targets to support.  Loadable modules are also useful for debugging a
pass or providing a pass with another package if that pass can&#8217;t be included in
LLVM.</p>
<p>LLVM provides complete support for building such a module. All you need to do is
use the <code class="docutils literal"><span class="pre">LOADABLE_MODULE</span></code> variable in your <code class="docutils literal"><span class="pre">Makefile</span></code>. For example, to build
a loadable module named <code class="docutils literal"><span class="pre">MyMod</span></code> that uses the LLVM libraries <code class="docutils literal"><span class="pre">LLVMSupport.a</span></code>
and <code class="docutils literal"><span class="pre">LLVMSystem.a</span></code>, you would specify:</p>
<div class="highlight-makefile"><div class="highlight"><pre><span class="nv">LIBRARYNAME</span> <span class="o">:=</span> MyMod
<span class="nv">LOADABLE_MODULE</span> <span class="o">:=</span> 1
<span class="nv">LINK_COMPONENTS</span> <span class="o">:=</span> support system
</pre></div>
</div>
<p>Use of the <code class="docutils literal"><span class="pre">LOADABLE_MODULE</span></code> facility implies several things:</p>
<ol class="arabic">
<li><dl class="first docutils">
<dt>There will be no &#8220;<code class="docutils literal"><span class="pre">lib</span></code>&#8221; prefix on the module. This differentiates it from</dt>
<dd><p class="first last">a standard shared library of the same name.</p>
</dd>
</dl>
</li>
<li><p class="first">The <a class="reference internal" href="#shared-library">SHARED_LIBRARY</a> variable is turned on.</p>
</li>
<li><p class="first">The <a class="reference internal" href="#link-libs-in-shared">LINK_LIBS_IN_SHARED</a> variable is turned on.</p>
</li>
</ol>
<p>A loadable module is loaded by LLVM via the facilities of libtool&#8217;s libltdl
library which is part of <code class="docutils literal"><span class="pre">lib/System</span></code> implementation.</p>
</div>
</div>
<div class="section" id="tools">
<h3><a class="toc-backref" href="#id16">Tools</a><a class="headerlink" href="#tools" title="Permalink to this headline">¶</a></h3>
<p>For building executable programs (tools), you must provide the name of the tool
and the names of the libraries you wish to link with the tool. For example:</p>
<div class="highlight-makefile"><div class="highlight"><pre><span class="nv">TOOLNAME</span> <span class="o">=</span> mytool
<span class="nv">USEDLIBS</span> <span class="o">=</span> mylib
<span class="nv">LINK_COMPONENTS</span> <span class="o">=</span> support system
</pre></div>
</div>
<p>says that we are to build a tool name <code class="docutils literal"><span class="pre">mytool</span></code> and that it requires three
libraries: <code class="docutils literal"><span class="pre">mylib</span></code>, <code class="docutils literal"><span class="pre">LLVMSupport.a</span></code> and <code class="docutils literal"><span class="pre">LLVMSystem.a</span></code>.</p>
<p>Note that two different variables are used to indicate which libraries are
linked: <code class="docutils literal"><span class="pre">USEDLIBS</span></code> and <code class="docutils literal"><span class="pre">LLVMLIBS</span></code>. This distinction is necessary to support
projects. <code class="docutils literal"><span class="pre">LLVMLIBS</span></code> refers to the LLVM libraries found in the LLVM object
directory. <code class="docutils literal"><span class="pre">USEDLIBS</span></code> refers to the libraries built by your project. In the
case of building LLVM tools, <code class="docutils literal"><span class="pre">USEDLIBS</span></code> and <code class="docutils literal"><span class="pre">LLVMLIBS</span></code> can be used
interchangeably since the &#8220;project&#8221; is LLVM itself and <code class="docutils literal"><span class="pre">USEDLIBS</span></code> refers to
the same place as <code class="docutils literal"><span class="pre">LLVMLIBS</span></code>.</p>
<p>Also note that there are two different ways of specifying a library: with a
<code class="docutils literal"><span class="pre">.a</span></code> suffix and without. Without the suffix, the entry refers to the re-linked
(.o) file which will include <em>all</em> symbols of the library.  This is
useful, for example, to include all passes from a library of passes.  If the
<code class="docutils literal"><span class="pre">.a</span></code> suffix is used then the library is linked as a searchable library (with
the <code class="docutils literal"><span class="pre">-l</span></code> option). In this case, only the symbols that are unresolved <em>at
that point</em> will be resolved from the library, if they exist. Other
(unreferenced) symbols will not be included when the <code class="docutils literal"><span class="pre">.a</span></code> syntax is used. Note
that in order to use the <code class="docutils literal"><span class="pre">.a</span></code> suffix, the library in question must have been
built with the <code class="docutils literal"><span class="pre">BUILD_ARCHIVE</span></code> option set.</p>
<div class="section" id="jit-tools">
<h4><a class="toc-backref" href="#id17">JIT Tools</a><a class="headerlink" href="#jit-tools" title="Permalink to this headline">¶</a></h4>
<p>Many tools will want to use the JIT features of LLVM.  To do this, you simply
specify that you want an execution &#8216;engine&#8217;, and the makefiles will
automatically link in the appropriate JIT for the host or an interpreter if none
is available:</p>
<div class="highlight-makefile"><div class="highlight"><pre><span class="nv">TOOLNAME</span> <span class="o">=</span> my_jit_tool
<span class="nv">USEDLIBS</span> <span class="o">=</span> mylib
<span class="nv">LINK_COMPONENTS</span> <span class="o">=</span> engine
</pre></div>
</div>
<p>Of course, any additional libraries may be listed as other components.  To get a
full understanding of how this changes the linker command, it is recommended
that you:</p>
<div class="highlight-bash"><div class="highlight"><pre>% <span class="nb">cd </span>examples/Fibonacci
% make <span class="nv">VERBOSE</span><span class="o">=</span>1
</pre></div>
</div>
</div>
</div>
</div>
<div class="section" id="targets-supported">
<h2><a class="toc-backref" href="#id18">Targets Supported</a><a class="headerlink" href="#targets-supported" title="Permalink to this headline">¶</a></h2>
<p>This section describes each of the targets that can be built using the LLVM
Makefile system. Any target can be invoked from any directory but not all are
applicable to a given directory (e.g. &#8220;check&#8221;, &#8220;dist&#8221; and &#8220;install&#8221; will always
operate as if invoked from the top level directory).</p>
<table border="1" class="docutils">
<colgroup>
<col width="12%" />
<col width="10%" />
<col width="78%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Target Name</th>
<th class="head">Implied Targets</th>
<th class="head">Target Description</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal"><span class="pre">all</span></code></td>
<td></td>
<td>Compile the software recursively. Default target.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">all-local</span></code></td>
<td></td>
<td>Compile the software in the local directory only.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">check</span></code></td>
<td></td>
<td>Change to the <code class="docutils literal"><span class="pre">test</span></code> directory in a project and run the test suite there.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">check-local</span></code></td>
<td></td>
<td>Run a local test suite. Generally this is only defined in the  <code class="docutils literal"><span class="pre">Makefile</span></code> of the project&#8217;s <code class="docutils literal"><span class="pre">test</span></code> directory.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">clean</span></code></td>
<td></td>
<td>Remove built objects recursively.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">clean-local</span></code></td>
<td></td>
<td>Remove built objects from the local directory only.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">dist</span></code></td>
<td><code class="docutils literal"><span class="pre">all</span></code></td>
<td>Prepare a source distribution tarball.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">dist-check</span></code></td>
<td><code class="docutils literal"><span class="pre">all</span></code></td>
<td>Prepare a source distribution tarball and check that it builds.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">dist-clean</span></code></td>
<td><code class="docutils literal"><span class="pre">clean</span></code></td>
<td>Clean source distribution tarball temporary files.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">install</span></code></td>
<td><code class="docutils literal"><span class="pre">all</span></code></td>
<td>Copy built objects to installation directory.</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">preconditions</span></code></td>
<td><code class="docutils literal"><span class="pre">all</span></code></td>
<td>Check to make sure configuration and makefiles are up to date.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">printvars</span></code></td>
<td><code class="docutils literal"><span class="pre">all</span></code></td>
<td>Prints variables defined by the makefile system (for debugging).</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">tags</span></code></td>
<td></td>
<td>Make C and C++ tags files for emacs and vi.</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">uninstall</span></code></td>
<td></td>
<td>Remove built objects from installation directory.</td>
</tr>
</tbody>
</table>
<div class="section" id="all-default">
<span id="all"></span><h3><a class="toc-backref" href="#id19"><code class="docutils literal"><span class="pre">all</span></code> (default)</a><a class="headerlink" href="#all-default" title="Permalink to this headline">¶</a></h3>
<p>When you invoke <code class="docutils literal"><span class="pre">make</span></code> with no arguments, you are implicitly instructing it to
seek the <code class="docutils literal"><span class="pre">all</span></code> target (goal). This target is used for building the software
recursively and will do different things in different directories.  For example,
in a <code class="docutils literal"><span class="pre">lib</span></code> directory, the <code class="docutils literal"><span class="pre">all</span></code> target will compile source files and
generate libraries. But, in a <code class="docutils literal"><span class="pre">tools</span></code> directory, it will link libraries and
generate executables.</p>
</div>
<div class="section" id="all-local">
<h3><a class="toc-backref" href="#id20"><code class="docutils literal"><span class="pre">all-local</span></code></a><a class="headerlink" href="#all-local" title="Permalink to this headline">¶</a></h3>
<p>This target is the same as <a class="reference internal" href="#all">all</a> but it operates only on the current directory
instead of recursively.</p>
</div>
<div class="section" id="check">
<h3><a class="toc-backref" href="#id21"><code class="docutils literal"><span class="pre">check</span></code></a><a class="headerlink" href="#check" title="Permalink to this headline">¶</a></h3>
<p>This target can be invoked from anywhere within a project&#8217;s directories but
always invokes the <a class="reference internal" href="#check-local">check-local</a> target in the project&#8217;s <code class="docutils literal"><span class="pre">test</span></code> directory, if
it exists and has a <code class="docutils literal"><span class="pre">Makefile</span></code>. A warning is produced otherwise.  If
<a class="reference internal" href="#testsuite">TESTSUITE</a> is defined on the <code class="docutils literal"><span class="pre">make</span></code> command line, it will be passed down to
the invocation of <code class="docutils literal"><span class="pre">make</span> <span class="pre">check-local</span></code> in the <code class="docutils literal"><span class="pre">test</span></code> directory. The intended
usage for this is to assist in running specific suites of tests. If
<code class="docutils literal"><span class="pre">TESTSUITE</span></code> is not set, the implementation of <code class="docutils literal"><span class="pre">check-local</span></code> should run all
normal tests.  It is up to the project to define what different values for
<code class="docutils literal"><span class="pre">TESTSUTE</span></code> will do. See the <a class="reference internal" href="TestingGuide.html"><em>Testing Guide</em></a> for further
details.</p>
</div>
<div class="section" id="check-local">
<h3><a class="toc-backref" href="#id22"><code class="docutils literal"><span class="pre">check-local</span></code></a><a class="headerlink" href="#check-local" title="Permalink to this headline">¶</a></h3>
<p>This target should be implemented by the <code class="docutils literal"><span class="pre">Makefile</span></code> in the project&#8217;s <code class="docutils literal"><span class="pre">test</span></code>
directory. It is invoked by the <code class="docutils literal"><span class="pre">check</span></code> target elsewhere.  Each project is
free to define the actions of <code class="docutils literal"><span class="pre">check-local</span></code> as appropriate for that
project. The LLVM project itself uses the <a class="reference internal" href="CommandGuide/lit.html"><em>Lit</em></a> testing
tool to run a suite of feature and regression tests. Other projects may choose
to use <strong class="program">lit</strong> or any other testing mechanism.</p>
</div>
<div class="section" id="clean">
<h3><a class="toc-backref" href="#id23"><code class="docutils literal"><span class="pre">clean</span></code></a><a class="headerlink" href="#clean" title="Permalink to this headline">¶</a></h3>
<p>This target cleans the build directory, recursively removing all things that the
Makefile builds. The cleaning rules have been made guarded so they shouldn&#8217;t go
awry (via <code class="docutils literal"><span class="pre">rm</span> <span class="pre">-f</span> <span class="pre">$(UNSET_VARIABLE)/*</span></code> which will attempt to erase the entire
directory structure).</p>
</div>
<div class="section" id="clean-local">
<h3><a class="toc-backref" href="#id24"><code class="docutils literal"><span class="pre">clean-local</span></code></a><a class="headerlink" href="#clean-local" title="Permalink to this headline">¶</a></h3>
<p>This target does the same thing as <code class="docutils literal"><span class="pre">clean</span></code> but only for the current (local)
directory.</p>
</div>
<div class="section" id="dist">
<h3><a class="toc-backref" href="#id25"><code class="docutils literal"><span class="pre">dist</span></code></a><a class="headerlink" href="#dist" title="Permalink to this headline">¶</a></h3>
<p>This target builds a distribution tarball. It first builds the entire project
using the <code class="docutils literal"><span class="pre">all</span></code> target and then tars up the necessary files and compresses
it. The generated tarball is sufficient for a casual source distribution, but
probably not for a release (see <code class="docutils literal"><span class="pre">dist-check</span></code>).</p>
</div>
<div class="section" id="dist-check">
<h3><a class="toc-backref" href="#id26"><code class="docutils literal"><span class="pre">dist-check</span></code></a><a class="headerlink" href="#dist-check" title="Permalink to this headline">¶</a></h3>
<p>This target does the same thing as the <code class="docutils literal"><span class="pre">dist</span></code> target but also checks the
distribution tarball. The check is made by unpacking the tarball to a new
directory, configuring it, building it, installing it, and then verifying that
the installation results are correct (by comparing to the original build).  This
target can take a long time to run but should be done before a release goes out
to make sure that the distributed tarball can actually be built into a working
release.</p>
</div>
<div class="section" id="dist-clean">
<h3><a class="toc-backref" href="#id27"><code class="docutils literal"><span class="pre">dist-clean</span></code></a><a class="headerlink" href="#dist-clean" title="Permalink to this headline">¶</a></h3>
<p>This is a special form of the <code class="docutils literal"><span class="pre">clean</span></code> clean target. It performs a normal
<code class="docutils literal"><span class="pre">clean</span></code> but also removes things pertaining to building the distribution.</p>
</div>
<div class="section" id="install">
<h3><a class="toc-backref" href="#id28"><code class="docutils literal"><span class="pre">install</span></code></a><a class="headerlink" href="#install" title="Permalink to this headline">¶</a></h3>
<p>This target finalizes shared objects and executables and copies all libraries,
headers, executables and documentation to the directory given with the
<code class="docutils literal"><span class="pre">--prefix</span></code> option to <code class="docutils literal"><span class="pre">configure</span></code>.  When completed, the prefix directory will
have everything needed to <strong>use</strong> LLVM.</p>
<p>The LLVM makefiles can generate complete <strong>internal</strong> documentation for all the
classes by using <code class="docutils literal"><span class="pre">doxygen</span></code>. By default, this feature is <strong>not</strong> enabled
because it takes a long time and generates a massive amount of data (&gt;100MB). If
you want this feature, you must configure LLVM with the &#8211;enable-doxygen switch
and ensure that a modern version of doxygen (1.3.7 or later) is available in
your <code class="docutils literal"><span class="pre">PATH</span></code>. You can download doxygen from <a class="reference external" href="http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc">here</a>.</p>
</div>
<div class="section" id="preconditions">
<h3><a class="toc-backref" href="#id29"><code class="docutils literal"><span class="pre">preconditions</span></code></a><a class="headerlink" href="#preconditions" title="Permalink to this headline">¶</a></h3>
<p>This utility target checks to see if the <code class="docutils literal"><span class="pre">Makefile</span></code> in the object directory is
older than the <code class="docutils literal"><span class="pre">Makefile</span></code> in the source directory and copies it if so. It also
reruns the <code class="docutils literal"><span class="pre">configure</span></code> script if that needs to be done and rebuilds the
<code class="docutils literal"><span class="pre">Makefile.config</span></code> file similarly. Users may overload this target to ensure
that sanity checks are run <em>before</em> any building of targets as all the targets
depend on <code class="docutils literal"><span class="pre">preconditions</span></code>.</p>
</div>
<div class="section" id="printvars">
<h3><a class="toc-backref" href="#id30"><code class="docutils literal"><span class="pre">printvars</span></code></a><a class="headerlink" href="#printvars" title="Permalink to this headline">¶</a></h3>
<p>This utility target just causes the LLVM makefiles to print out some of the
makefile variables so that you can double check how things are set.</p>
</div>
<div class="section" id="reconfigure">
<h3><a class="toc-backref" href="#id31"><code class="docutils literal"><span class="pre">reconfigure</span></code></a><a class="headerlink" href="#reconfigure" title="Permalink to this headline">¶</a></h3>
<p>This utility target will force a reconfigure of LLVM or your project. It simply
runs <code class="docutils literal"><span class="pre">$(PROJ_OBJ_ROOT)/config.status</span> <span class="pre">--recheck</span></code> to rerun the configuration
tests and rebuild the configured files. This isn&#8217;t generally useful as the
makefiles will reconfigure themselves whenever its necessary.</p>
</div>
<div class="section" id="spotless">
<h3><a class="toc-backref" href="#id32"><code class="docutils literal"><span class="pre">spotless</span></code></a><a class="headerlink" href="#spotless" title="Permalink to this headline">¶</a></h3>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">Use with caution!</p>
</div>
<p>This utility target, only available when <code class="docutils literal"><span class="pre">$(PROJ_OBJ_ROOT)</span></code> is not the same as
<code class="docutils literal"><span class="pre">$(PROJ_SRC_ROOT)</span></code>, will completely clean the <code class="docutils literal"><span class="pre">$(PROJ_OBJ_ROOT)</span></code> directory
by removing its content entirely and reconfiguring the directory. This returns
the <code class="docutils literal"><span class="pre">$(PROJ_OBJ_ROOT)</span></code> directory to a completely fresh state. All content in
the directory except configured files and top-level makefiles will be lost.</p>
</div>
<div class="section" id="tags">
<h3><a class="toc-backref" href="#id33"><code class="docutils literal"><span class="pre">tags</span></code></a><a class="headerlink" href="#tags" title="Permalink to this headline">¶</a></h3>
<p>This target will generate a <code class="docutils literal"><span class="pre">TAGS</span></code> file in the top-level source directory. It
is meant for use with emacs, XEmacs, or ViM. The TAGS file provides an index of
symbol definitions so that the editor can jump you to the definition
quickly.</p>
</div>
<div class="section" id="uninstall">
<h3><a class="toc-backref" href="#id34"><code class="docutils literal"><span class="pre">uninstall</span></code></a><a class="headerlink" href="#uninstall" title="Permalink to this headline">¶</a></h3>
<p>This target is the opposite of the <code class="docutils literal"><span class="pre">install</span></code> target. It removes the header,
library and executable files from the installation directories. Note that the
directories themselves are not removed because it is not guaranteed that LLVM is
the only thing installing there (e.g. <code class="docutils literal"><span class="pre">--prefix=/usr</span></code>).</p>
</div>
</div>
<div class="section" id="variables">
<span id="id2"></span><h2><a class="toc-backref" href="#id35">Variables</a><a class="headerlink" href="#variables" title="Permalink to this headline">¶</a></h2>
<p>Variables are used to tell the LLVM Makefile System what to do and to obtain
information from it. Variables are also used internally by the LLVM Makefile
System. Variable names that contain only the upper case alphabetic letters and
underscore are intended for use by the end user. All other variables are
internal to the LLVM Makefile System and should not be relied upon nor
modified. The sections below describe how to use the LLVM Makefile
variables.</p>
<div class="section" id="control-variables">
<h3><a class="toc-backref" href="#id36">Control Variables</a><a class="headerlink" href="#control-variables" title="Permalink to this headline">¶</a></h3>
<p>Variables listed in the table below should be set <em>before</em> the inclusion of
<a class="reference internal" href="#level-makefile-common">$(LEVEL)/Makefile.common</a>.  These variables provide input to the LLVM make
system that tell it what to do for the current directory.</p>
<dl class="docutils">
<dt><code class="docutils literal"><span class="pre">BUILD_ARCHIVE</span></code></dt>
<dd>If set to any value, causes an archive (.a) library to be built.</dd>
<dt><code class="docutils literal"><span class="pre">BUILT_SOURCES</span></code></dt>
<dd>Specifies a set of source files that are generated from other source
files. These sources will be built before any other target processing to
ensure they are present.</dd>
<dt><code class="docutils literal"><span class="pre">CONFIG_FILES</span></code></dt>
<dd>Specifies a set of configuration files to be installed.</dd>
<dt><code class="docutils literal"><span class="pre">DEBUG_SYMBOLS</span></code></dt>
<dd>If set to any value, causes the build to include debugging symbols even in
optimized objects, libraries and executables. This alters the flags
specified to the compilers and linkers. Debugging isn&#8217;t fun in an optimized
build, but it is possible.</dd>
<dt><code class="docutils literal"><span class="pre">DIRS</span></code></dt>
<dd>Specifies a set of directories, usually children of the current directory,
that should also be made using the same goal. These directories will be
built serially.</dd>
<dt><code class="docutils literal"><span class="pre">DISABLE_AUTO_DEPENDENCIES</span></code></dt>
<dd>If set to any value, causes the makefiles to <strong>not</strong> automatically generate
dependencies when running the compiler. Use of this feature is discouraged
and it may be removed at a later date.</dd>
<dt><code class="docutils literal"><span class="pre">ENABLE_OPTIMIZED</span></code></dt>
<dd>If set to 1, causes the build to generate optimized objects, libraries and
executables. This alters the flags specified to the compilers and
linkers. Generally debugging won&#8217;t be a fun experience with an optimized
build.</dd>
<dt><code class="docutils literal"><span class="pre">ENABLE_PROFILING</span></code></dt>
<dd>If set to 1, causes the build to generate both optimized and profiled
objects, libraries and executables. This alters the flags specified to the
compilers and linkers to ensure that profile data can be collected from the
tools built. Use the <code class="docutils literal"><span class="pre">gprof</span></code> tool to analyze the output from the profiled
tools (<code class="docutils literal"><span class="pre">gmon.out</span></code>).</dd>
<dt><code class="docutils literal"><span class="pre">DISABLE_ASSERTIONS</span></code></dt>
<dd>If set to 1, causes the build to disable assertions, even if building a
debug or profile build.  This will exclude all assertion check code from the
build. LLVM will execute faster, but with little help when things go
wrong.</dd>
<dt><code class="docutils literal"><span class="pre">EXPERIMENTAL_DIRS</span></code></dt>
<dd>Specify a set of directories that should be built, but if they fail, it
should not cause the build to fail. Note that this should only be used
temporarily while code is being written.</dd>
<dt><code class="docutils literal"><span class="pre">EXPORTED_SYMBOL_FILE</span></code></dt>
<dd>Specifies the name of a single file that contains a list of the symbols to
be exported by the linker. One symbol per line.</dd>
<dt><code class="docutils literal"><span class="pre">EXPORTED_SYMBOL_LIST</span></code></dt>
<dd>Specifies a set of symbols to be exported by the linker.</dd>
<dt><code class="docutils literal"><span class="pre">EXTRA_DIST</span></code></dt>
<dd>Specifies additional files that should be distributed with LLVM. All source
files, all built sources, all Makefiles, and most documentation files will
be automatically distributed. Use this variable to distribute any files that
are not automatically distributed.</dd>
<dt><code class="docutils literal"><span class="pre">KEEP_SYMBOLS</span></code></dt>
<dd>If set to any value, specifies that when linking executables the makefiles
should retain debug symbols in the executable. Normally, symbols are
stripped from the executable.</dd>
<dt><code class="docutils literal"><span class="pre">LEVEL</span></code> (required)</dt>
<dd>Specify the level of nesting from the top level. This variable must be set
in each makefile as it is used to find the top level and thus the other
makefiles.</dd>
<dt><code class="docutils literal"><span class="pre">LIBRARYNAME</span></code></dt>
<dd>Specify the name of the library to be built. (Required For Libraries)</dd>
<dt><code class="docutils literal"><span class="pre">LINK_COMPONENTS</span></code></dt>
<dd>When specified for building a tool, the value of this variable will be
passed to the <code class="docutils literal"><span class="pre">llvm-config</span></code> tool to generate a link line for the
tool. Unlike <code class="docutils literal"><span class="pre">USEDLIBS</span></code> and <code class="docutils literal"><span class="pre">LLVMLIBS</span></code>, not all libraries need to be
specified. The <code class="docutils literal"><span class="pre">llvm-config</span></code> tool will figure out the library dependencies
and add any libraries that are needed. The <code class="docutils literal"><span class="pre">USEDLIBS</span></code> variable can still
be used in conjunction with <code class="docutils literal"><span class="pre">LINK_COMPONENTS</span></code> so that additional
project-specific libraries can be linked with the LLVM libraries specified
by <code class="docutils literal"><span class="pre">LINK_COMPONENTS</span></code>.</dd>
</dl>
<dl class="docutils" id="link-libs-in-shared">
<dt><code class="docutils literal"><span class="pre">LINK_LIBS_IN_SHARED</span></code></dt>
<dd>By default, shared library linking will ignore any libraries specified with
the <a class="reference internal" href="#llvmlibs">LLVMLIBS</a> or <a class="reference internal" href="#usedlibs">USEDLIBS</a>. This prevents shared libs from including
things that will be in the LLVM tool the shared library will be loaded
into. However, sometimes it is useful to link certain libraries into your
shared library and this option enables that feature.</dd>
</dl>
<dl class="docutils" id="llvmlibs">
<dt><code class="docutils literal"><span class="pre">LLVMLIBS</span></code></dt>
<dd>Specifies the set of libraries from the LLVM <code class="docutils literal"><span class="pre">$(ObjDir)</span></code> that will be
linked into the tool or library.</dd>
<dt><code class="docutils literal"><span class="pre">LOADABLE_MODULE</span></code></dt>
<dd>If set to any value, causes the shared library being built to also be a
loadable module. Loadable modules can be opened with the dlopen() function
and searched with dlsym (or the operating system&#8217;s equivalent). Note that
setting this variable without also setting <code class="docutils literal"><span class="pre">SHARED_LIBRARY</span></code> will have no
effect.</dd>
<dt><code class="docutils literal"><span class="pre">NO_INSTALL</span></code></dt>
<dd>Specifies that the build products of the directory should not be installed
but should be built even if the <code class="docutils literal"><span class="pre">install</span></code> target is given.  This is handy
for directories that build libraries or tools that are only used as part of
the build process, such as code generators (e.g.  <code class="docutils literal"><span class="pre">tblgen</span></code>).</dd>
<dt><code class="docutils literal"><span class="pre">OPTIONAL_DIRS</span></code></dt>
<dd>Specify a set of directories that may be built, if they exist, but it is
not an error for them not to exist.</dd>
<dt><code class="docutils literal"><span class="pre">PARALLEL_DIRS</span></code></dt>
<dd>Specify a set of directories to build recursively and in parallel if the
<code class="docutils literal"><span class="pre">-j</span></code> option was used with <code class="docutils literal"><span class="pre">make</span></code>.</dd>
</dl>
<dl class="docutils" id="shared-library">
<dt><code class="docutils literal"><span class="pre">SHARED_LIBRARY</span></code></dt>
<dd>If set to any value, causes a shared library (<code class="docutils literal"><span class="pre">.so</span></code>) to be built in
addition to any other kinds of libraries. Note that this option will cause
all source files to be built twice: once with options for position
independent code and once without. Use it only where you really need a
shared library.</dd>
<dt><code class="docutils literal"><span class="pre">SOURCES</span></code> (optional)</dt>
<dd>Specifies the list of source files in the current directory to be
built. Source files of any type may be specified (programs, documentation,
config files, etc.). If not specified, the makefile system will infer the
set of source files from the files present in the current directory.</dd>
<dt><code class="docutils literal"><span class="pre">SUFFIXES</span></code></dt>
<dd>Specifies a set of filename suffixes that occur in suffix match rules.  Only
set this if your local <code class="docutils literal"><span class="pre">Makefile</span></code> specifies additional suffix match
rules.</dd>
<dt><code class="docutils literal"><span class="pre">TARGET</span></code></dt>
<dd>Specifies the name of the LLVM code generation target that the current
directory builds. Setting this variable enables additional rules to build
<code class="docutils literal"><span class="pre">.inc</span></code> files from <code class="docutils literal"><span class="pre">.td</span></code> files.</dd>
</dl>
<dl class="docutils" id="testsuite">
<dt><code class="docutils literal"><span class="pre">TESTSUITE</span></code></dt>
<dd>Specifies the directory of tests to run in <code class="docutils literal"><span class="pre">llvm/test</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">TOOLNAME</span></code></dt>
<dd>Specifies the name of the tool that the current directory should build.</dd>
<dt><code class="docutils literal"><span class="pre">TOOL_VERBOSE</span></code></dt>
<dd>Implies <code class="docutils literal"><span class="pre">VERBOSE</span></code> and also tells each tool invoked to be verbose. This is
handy when you&#8217;re trying to see the sub-tools invoked by each tool invoked
by the makefile. For example, this will pass <code class="docutils literal"><span class="pre">-v</span></code> to the GCC compilers
which causes it to print out the command lines it uses to invoke sub-tools
(compiler, assembler, linker).</dd>
</dl>
<dl class="docutils" id="usedlibs">
<dt><code class="docutils literal"><span class="pre">USEDLIBS</span></code></dt>
<dd>Specifies the list of project libraries that will be linked into the tool or
library.</dd>
<dt><code class="docutils literal"><span class="pre">VERBOSE</span></code></dt>
<dd>Tells the Makefile system to produce detailed output of what it is doing
instead of just summary comments. This will generate a LOT of output.</dd>
</dl>
</div>
<div class="section" id="override-variables">
<h3><a class="toc-backref" href="#id37">Override Variables</a><a class="headerlink" href="#override-variables" title="Permalink to this headline">¶</a></h3>
<p>Override variables can be used to override the default values provided by the
LLVM makefile system. These variables can be set in several ways:</p>
<ul class="simple">
<li>In the environment (e.g. setenv, export) &#8212; not recommended.</li>
<li>On the <code class="docutils literal"><span class="pre">make</span></code> command line &#8212; recommended.</li>
<li>On the <code class="docutils literal"><span class="pre">configure</span></code> command line.</li>
<li>In the Makefile (only <em>after</em> the inclusion of <a class="reference internal" href="#level-makefile-common">$(LEVEL)/Makefile.common</a>).</li>
</ul>
<p>The override variables are given below:</p>
<dl class="docutils">
<dt><code class="docutils literal"><span class="pre">AR</span></code> (defaulted)</dt>
<dd>Specifies the path to the <code class="docutils literal"><span class="pre">ar</span></code> tool.</dd>
<dt><code class="docutils literal"><span class="pre">PROJ_OBJ_DIR</span></code></dt>
<dd>The directory into which the products of build rules will be placed.  This
might be the same as <a class="reference internal" href="#proj-src-dir">PROJ_SRC_DIR</a> but typically is not.</dd>
</dl>
<dl class="docutils" id="proj-src-dir">
<dt><code class="docutils literal"><span class="pre">PROJ_SRC_DIR</span></code></dt>
<dd>The directory which contains the source files to be built.</dd>
<dt><code class="docutils literal"><span class="pre">BUILD_EXAMPLES</span></code></dt>
<dd>If set to 1, build examples in <code class="docutils literal"><span class="pre">examples</span></code> and (if building Clang)
<code class="docutils literal"><span class="pre">tools/clang/examples</span></code> directories.</dd>
<dt><code class="docutils literal"><span class="pre">BZIP2</span></code> (configured)</dt>
<dd>The path to the <code class="docutils literal"><span class="pre">bzip2</span></code> tool.</dd>
<dt><code class="docutils literal"><span class="pre">CC</span></code> (configured)</dt>
<dd>The path to the &#8216;C&#8217; compiler.</dd>
<dt><code class="docutils literal"><span class="pre">CFLAGS</span></code></dt>
<dd>Additional flags to be passed to the &#8216;C&#8217; compiler.</dd>
<dt><code class="docutils literal"><span class="pre">CPPFLAGS</span></code></dt>
<dd>Additional flags passed to the C/C++ preprocessor.</dd>
<dt><code class="docutils literal"><span class="pre">CXX</span></code></dt>
<dd>Specifies the path to the C++ compiler.</dd>
<dt><code class="docutils literal"><span class="pre">CXXFLAGS</span></code></dt>
<dd>Additional flags to be passed to the C++ compiler.</dd>
<dt><code class="docutils literal"><span class="pre">DATE</span></code> (configured)</dt>
<dd>Specifies the path to the <code class="docutils literal"><span class="pre">date</span></code> program or any program that can generate
the current date and time on its standard output.</dd>
<dt><code class="docutils literal"><span class="pre">DOT</span></code> (configured)</dt>
<dd>Specifies the path to the <code class="docutils literal"><span class="pre">dot</span></code> tool or <code class="docutils literal"><span class="pre">false</span></code> if there isn&#8217;t one.</dd>
<dt><code class="docutils literal"><span class="pre">ECHO</span></code> (configured)</dt>
<dd>Specifies the path to the <code class="docutils literal"><span class="pre">echo</span></code> tool for printing output.</dd>
<dt><code class="docutils literal"><span class="pre">EXEEXT</span></code> (configured)</dt>
<dd>Provides the extension to be used on executables built by the makefiles.
The value may be empty on platforms that do not use file extensions for
executables (e.g. Unix).</dd>
<dt><code class="docutils literal"><span class="pre">INSTALL</span></code> (configured)</dt>
<dd>Specifies the path to the <code class="docutils literal"><span class="pre">install</span></code> tool.</dd>
<dt><code class="docutils literal"><span class="pre">LDFLAGS</span></code> (configured)</dt>
<dd>Allows users to specify additional flags to pass to the linker.</dd>
<dt><code class="docutils literal"><span class="pre">LIBS</span></code> (configured)</dt>
<dd>The list of libraries that should be linked with each tool.</dd>
<dt><code class="docutils literal"><span class="pre">LIBTOOL</span></code> (configured)</dt>
<dd>Specifies the path to the <code class="docutils literal"><span class="pre">libtool</span></code> tool. This tool is renamed <code class="docutils literal"><span class="pre">mklib</span></code>
by the <code class="docutils literal"><span class="pre">configure</span></code> script.</dd>
<dt><code class="docutils literal"><span class="pre">LLVMAS</span></code> (defaulted)</dt>
<dd>Specifies the path to the <code class="docutils literal"><span class="pre">llvm-as</span></code> tool.</dd>
<dt><code class="docutils literal"><span class="pre">LLVMGCC</span></code> (defaulted)</dt>
<dd>Specifies the path to the LLVM version of the GCC &#8216;C&#8217; Compiler.</dd>
<dt><code class="docutils literal"><span class="pre">LLVMGXX</span></code> (defaulted)</dt>
<dd>Specifies the path to the LLVM version of the GCC C++ Compiler.</dd>
<dt><code class="docutils literal"><span class="pre">LLVMLD</span></code> (defaulted)</dt>
<dd>Specifies the path to the LLVM bitcode linker tool</dd>
<dt><code class="docutils literal"><span class="pre">LLVM_OBJ_ROOT</span></code> (configured)</dt>
<dd>Specifies the top directory into which the output of the build is placed.</dd>
<dt><code class="docutils literal"><span class="pre">LLVM_SRC_ROOT</span></code> (configured)</dt>
<dd>Specifies the top directory in which the sources are found.</dd>
<dt><code class="docutils literal"><span class="pre">LLVM_TARBALL_NAME</span></code> (configured)</dt>
<dd>Specifies the name of the distribution tarball to create. This is configured
from the name of the project and its version number.</dd>
<dt><code class="docutils literal"><span class="pre">MKDIR</span></code> (defaulted)</dt>
<dd>Specifies the path to the <code class="docutils literal"><span class="pre">mkdir</span></code> tool that creates directories.</dd>
<dt><code class="docutils literal"><span class="pre">ONLY_TOOLS</span></code></dt>
<dd>If set, specifies the list of tools to build.</dd>
<dt><code class="docutils literal"><span class="pre">PLATFORMSTRIPOPTS</span></code></dt>
<dd>The options to provide to the linker to specify that a stripped (no symbols)
executable should be built.</dd>
<dt><code class="docutils literal"><span class="pre">RANLIB</span></code> (defaulted)</dt>
<dd>Specifies the path to the <code class="docutils literal"><span class="pre">ranlib</span></code> tool.</dd>
<dt><code class="docutils literal"><span class="pre">RM</span></code> (defaulted)</dt>
<dd>Specifies the path to the <code class="docutils literal"><span class="pre">rm</span></code> tool.</dd>
<dt><code class="docutils literal"><span class="pre">SED</span></code> (defaulted)</dt>
<dd>Specifies the path to the <code class="docutils literal"><span class="pre">sed</span></code> tool.</dd>
<dt><code class="docutils literal"><span class="pre">SHLIBEXT</span></code> (configured)</dt>
<dd>Provides the filename extension to use for shared libraries.</dd>
<dt><code class="docutils literal"><span class="pre">TBLGEN</span></code> (defaulted)</dt>
<dd>Specifies the path to the <code class="docutils literal"><span class="pre">tblgen</span></code> tool.</dd>
<dt><code class="docutils literal"><span class="pre">TAR</span></code> (defaulted)</dt>
<dd>Specifies the path to the <code class="docutils literal"><span class="pre">tar</span></code> tool.</dd>
<dt><code class="docutils literal"><span class="pre">ZIP</span></code> (defaulted)</dt>
<dd>Specifies the path to the <code class="docutils literal"><span class="pre">zip</span></code> tool.</dd>
</dl>
</div>
<div class="section" id="readable-variables">
<h3><a class="toc-backref" href="#id38">Readable Variables</a><a class="headerlink" href="#readable-variables" title="Permalink to this headline">¶</a></h3>
<p>Variables listed in the table below can be used by the user&#8217;s Makefile but
should not be changed. Changing the value will generally cause the build to go
wrong, so don&#8217;t do it.</p>
<dl class="docutils">
<dt><code class="docutils literal"><span class="pre">bindir</span></code></dt>
<dd>The directory into which executables will ultimately be installed. This
value is derived from the <code class="docutils literal"><span class="pre">--prefix</span></code> option given to <code class="docutils literal"><span class="pre">configure</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">BuildMode</span></code></dt>
<dd>The name of the type of build being performed: Debug, Release, or
Profile.</dd>
<dt><code class="docutils literal"><span class="pre">bytecode_libdir</span></code></dt>
<dd>The directory into which bitcode libraries will ultimately be installed.
This value is derived from the <code class="docutils literal"><span class="pre">--prefix</span></code> option given to <code class="docutils literal"><span class="pre">configure</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">ConfigureScriptFLAGS</span></code></dt>
<dd>Additional flags given to the <code class="docutils literal"><span class="pre">configure</span></code> script when reconfiguring.</dd>
<dt><code class="docutils literal"><span class="pre">DistDir</span></code></dt>
<dd>The <em>current</em> directory for which a distribution copy is being made.</dd>
</dl>
<dl class="docutils" id="echo">
<dt><code class="docutils literal"><span class="pre">Echo</span></code></dt>
<dd>The LLVM Makefile System output command. This provides the <code class="docutils literal"><span class="pre">llvm[n]</span></code>
prefix and starts with <code class="docutils literal"><span class="pre">&#64;</span></code> so the command itself is not printed by
<code class="docutils literal"><span class="pre">make</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">EchoCmd</span></code></dt>
<dd>Same as <a class="reference internal" href="#echo">Echo</a> but without the leading <code class="docutils literal"><span class="pre">&#64;</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">includedir</span></code></dt>
<dd>The directory into which include files will ultimately be installed.  This
value is derived from the <code class="docutils literal"><span class="pre">--prefix</span></code> option given to <code class="docutils literal"><span class="pre">configure</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">libdir</span></code></dt>
<dd>The directory into which native libraries will ultimately be installed.
This value is derived from the <code class="docutils literal"><span class="pre">--prefix</span></code> option given to
<code class="docutils literal"><span class="pre">configure</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">LibDir</span></code></dt>
<dd>The configuration specific directory into which libraries are placed before
installation.</dd>
<dt><code class="docutils literal"><span class="pre">MakefileConfig</span></code></dt>
<dd>Full path of the <code class="docutils literal"><span class="pre">Makefile.config</span></code> file.</dd>
<dt><code class="docutils literal"><span class="pre">MakefileConfigIn</span></code></dt>
<dd>Full path of the <code class="docutils literal"><span class="pre">Makefile.config.in</span></code> file.</dd>
<dt><code class="docutils literal"><span class="pre">ObjDir</span></code></dt>
<dd>The configuration and directory specific directory where build objects
(compilation results) are placed.</dd>
<dt><code class="docutils literal"><span class="pre">SubDirs</span></code></dt>
<dd>The complete list of sub-directories of the current directory as
specified by other variables.</dd>
<dt><code class="docutils literal"><span class="pre">Sources</span></code></dt>
<dd>The complete list of source files.</dd>
<dt><code class="docutils literal"><span class="pre">sysconfdir</span></code></dt>
<dd>The directory into which configuration files will ultimately be
installed. This value is derived from the <code class="docutils literal"><span class="pre">--prefix</span></code> option given to
<code class="docutils literal"><span class="pre">configure</span></code>.</dd>
<dt><code class="docutils literal"><span class="pre">ToolDir</span></code></dt>
<dd>The configuration specific directory into which executables are placed
before they are installed.</dd>
<dt><code class="docutils literal"><span class="pre">TopDistDir</span></code></dt>
<dd>The top most directory into which the distribution files are copied.</dd>
<dt><code class="docutils literal"><span class="pre">Verb</span></code></dt>
<dd>Use this as the first thing on your build script lines to enable or disable
verbose mode. It expands to either an <code class="docutils literal"><span class="pre">&#64;</span></code> (quiet mode) or nothing (verbose
mode).</dd>
</dl>
</div>
<div class="section" id="internal-variables">
<h3><a class="toc-backref" href="#id39">Internal Variables</a><a class="headerlink" href="#internal-variables" title="Permalink to this headline">¶</a></h3>
<p>Variables listed below are used by the LLVM Makefile System and considered
internal. You should not use these variables under any circumstances.</p>
<div class="highlight-makefile"><div class="highlight"><pre>Archive
AR.Flags
BaseNameSources
BCLinkLib
C.Flags
Compile.C
CompileCommonOpts
Compile.CXX
ConfigStatusScript
ConfigureScript
CPP.Flags
CPP.Flags
CXX.Flags
DependFiles
DestArchiveLib
DestBitcodeLib
DestModule
DestSharedLib
DestTool
DistAlways
DistCheckDir
DistCheckTop
DistFiles
DistName
DistOther
DistSources
DistSubDirs
DistTarBZ2
DistTarGZip
DistZip
ExtraLibs
FakeSources
INCFiles
InternalTargets
LD.Flags
LibName.A
LibName.BC
LibName.LA
LibName.O
LibTool.Flags
Link
LinkModule
LLVMLibDir
LLVMLibsOptions
LLVMLibsPaths
LLVMToolDir
LLVMUsedLibs
LocalTargets
Module
ObjectsLO
ObjectsO
ObjMakefiles
ParallelTargets
PreConditions
ProjLibsOptions
ProjLibsPaths
ProjUsedLibs
Ranlib
RecursiveTargets
SrcMakefiles
Strip
StripWarnMsg
TableGen
TDFiles
ToolBuildPath
TopLevelTargets
UserTargets
</pre></div>
</div>
</div>
</div>
</div>


          </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="Projects.html" title="Creating an LLVM Project"
             >next</a> |</li>
        <li class="right" >
          <a href="DeveloperPolicy.html" title="LLVM Developer Policy"
             >previous</a> |</li>
  <li><a href="http://llvm.org/">LLVM Home</a>&nbsp;|&nbsp;</li>
  <li><a href="index.html">Documentation</a>&raquo;</li>
 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &copy; Copyright 2003-2015, LLVM Project.
      Last updated on 2015-09-08.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.
    </div>
  </body>
</html>